home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
nvdc87
/
lcv1n1
/
mean-p.pro
< prev
next >
Wrap
Text File
|
1987-08-11
|
669b
|
25 lines
/* Listing 2 - Turbo Prolog module to call C to find the mean,
which is passed back in a functor. */
domains
ilist=real*
ifunc=f(real)
global predicates
cpinit language c /* declare Turbo C initialization */
/* module, cpinit */
mean(ilist,ifunc) - (i,o) (o,i) language c
/* declare Turbo C module, mean. */
predicates
process(ilist)
goal
cpinit,
process([1.0,5.0,10.0,14.0]).
clauses
process(List):-
mean(List,Ans), /* Call Turbo C module to calculate mean */
write(Ans),nl.